package demo;

import com.lijinjiang.beautyeye.BeautyEyeLNFHelper;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.*;

/**
 * @ClassName BorderDemo
 * @Description TODO
 * @Author Li
 * @Date 2022/9/15 9:35
 * @ModifyDate 2022/9/15 9:35
 * @Version 1.0
 */
public class BorderDemo {
    public static void main(String[] args) {
        try {
            BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
            BeautyEyeLNFHelper.launchBeautyEyeLNF();
        } catch (Exception e) {
            e.printStackTrace();
        }
        JFrame frame = new JFrame();

        JPanel contentPane = new JPanel();
        contentPane.setLayout(new GridLayout(2, 4, 25, 25));

        JPanel panel1 = new JPanel();
        panel1.setBorder(BorderFactory.createLineBorder(Color.RED, 3));
        panel1.add(new JLabel("线边框"));
        contentPane.add(panel1);

        JPanel panel2 = new JPanel();
        panel2.setBorder(BorderFactory.createEtchedBorder());
        panel2.add(new JLabel("刻蚀边框"));
        contentPane.add(panel2);

        JPanel panel3 = new JPanel();
        panel3.setBorder(BorderFactory.createRaisedBevelBorder());
        panel3.add(new JLabel("斜面边框（凸）"));
        contentPane.add(panel3);

        JPanel panel4 = new JPanel();
        panel4.setBorder(BorderFactory.createLoweredBevelBorder());
        panel4.add(new JLabel("斜面边框（凹）"));
        contentPane.add(panel4);

        JPanel panel5 = new JPanel();
        panel5.setBorder(BorderFactory.createTitledBorder("标题"));
        panel5.add(new JLabel("标题边框"));
        contentPane.add(panel5);

        JPanel panel6 = new JPanel();
        TitledBorder rightTitle = BorderFactory.createTitledBorder("标题");
        rightTitle.setTitleJustification(TitledBorder.RIGHT);
        panel6.setBorder(rightTitle);
        panel6.add(new JLabel("标题边框（右）"));
        contentPane.add(panel6);

        JPanel panel7 = new JPanel();
        panel7.setBorder(BorderFactory.createMatteBorder(2, 10, 2, 2, Color.ORANGE));
        panel7.add(new JLabel("花色边框"));
        contentPane.add(panel7);

        JPanel panel8 = new JPanel();
        Border border1 = BorderFactory.createLineBorder(Color.GREEN, 3);
        Border border2 = BorderFactory.createEtchedBorder();
        panel8.setBorder(BorderFactory.createCompoundBorder(border1, border2));
        panel8.add(new JLabel("组合边框"));
        contentPane.add(panel8);

        frame.setContentPane(contentPane);
        frame.setSize(760, 400);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}
